<%= form_for [@game, @challenge], :url => game_challenges_path(@game), :as => :challenge do |f| %>
  <% if @challenge.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@challenge.errors.count, "error") %> prohibited this challenge from being saved:</h2>

      <ul>
      <% @challenge.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :title %>
    <%= f.text_field :title %>
  </div>

  <div class="field">
    <%= f.label :points %>
    <%= f.number_field :points %>
    <%= f.select(:point_kind_id, options_for_select(get_point_kinds)) %>
  </div>

  <div class="field">
    <%= f.label :description %>
    <%= f.text_area :description %>
  </div>

  <div class="field">
    <%= f.label :type %>
    <%= select_tag "challenge_type", options_for_select(get_challenge_types), { :name => "challenge[type]", 
    :data => { :remote => true, :url =>  url_for(:action => "type_change") }} 
    %>
 </div>

  <div id="challenge_type_details">
  </div>

  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>
